package com.mysteel.order.service;

import com.alipay.api.AlipayApiException;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mysteel.common.to.mq.SecKillOrderTo;
import com.mysteel.common.utils.PageUtils;
import com.mysteel.order.entity.OrderEntity;
import com.mysteel.order.exception.CommonException;
import com.mysteel.order.vo.*;

import java.io.UnsupportedEncodingException;
import java.util.Map;

/**
 * 订单
 *
 * @author xc
 * @email xcremote@163.com
 * @date 2020-12-11 09:20:12
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 返回订单确认页数据
     * @return
     */
    OrderConfirmVo confirmOrder();

    SubmitOrderResponseVo submitOrder(OrderSubmitVo orderSubmitVo) throws CommonException;

    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭超时未支付的订单
     * @param orderEntity
     */
    void closeOrder(OrderEntity orderEntity) throws CommonException;

    /**
     * 根据订单号获取支付所用的vo
     * @param orderSn
     * @return
     */
    PayVo getOrderPay(String orderSn);

    /**
     * 订单列表分页渲染
     * @param params
     * @return
     */
    PageUtils queryPageWithItem(Map<String, Object> params);

    /**
     * 处理支付宝的异步通知结果
     * @param asyncVo
     * @return
     */
    String handleAliPayNotify(PayAsyncVo asyncVo,Map<String, String[]> parameterMap) throws AlipayApiException, UnsupportedEncodingException;

    void createSecKillOrder(SecKillOrderTo secKillOrderTo);
}

